package com.example.lj.uav.utils;

import java.math.BigDecimal;

public class DoubleUtils {
    /**
     * double格式化
     */
    public static double doubleFormat(double n, int figure) {
        try {
            return new BigDecimal(n).setScale(figure, BigDecimal.ROUND_HALF_UP)
                    .doubleValue();
        } catch (Exception e) {
            return 0;
        }
    }
}
